#include <stdio.h>

int median(int a, int b, int c)
{
    int max = (a > b ? a : b), min = (a < b ? a : b);
    max = (max > c ? max : c);
    min = (min < c ? min : c);
    return a + b + c - max - min;
}
int main(int argc, char const *argv[])
{
    int a[9];
    for (int i = 0; i < 9; i++)
        scanf("%d", a + i);
    printf("%d\n", median(median(a[0], a[1], a[2]), median(a[3], a[4], a[5]), median(a[6], a[7], a[8])));
    return 0;
}
